<script language="javascript" type="text/javascript" src="../../public/jquery.min.js"></script>

<section>
  <form action="/search" method="post">
    <fieldset>
      <legend>维度一下<span id="tts"></span></legend>
      <div>
        <input id="keyinput"  type="text" style="width: 500px" name="key" value=""/> <input type="submit" value="查询"/>
      </div>
      <div>
        <ol id="baiduxiala" style="list-style: none;-webkit-padding-start:0px"></ol>
      </div>
      <div id="serchlist">

      </div>
      <div>

      </div>
      <script>
        var I=$("#keyinput");
        var eum = {
          wd_AJBH:"案件编号维度",
          wd_DHHM:"电话号码维度",
          wd_HH:"户号维度",
          wd_XM:"姓名维度",
          wd_DZ:"地址维度",
          wd_DHHM:"电话号码维度",
          wd_HZHM:"护照号码维度",
          wd_FWCS:"服务处所维度",
          wd_AJSLWH:"案件受理文号维度",
          wd_AJMC:"案件名称维度",
          wd_AJBH:"<span style='color: red'>案件编号维度</span>",
          wd_SFZ:"<span style='color: red'>身份证维度</span>",
          wd_CPH:"<span style='color: red'>车牌号维度</span>",
          wd_JDMC:"酒店名称维度"
        };
        I.keyup(function (e) {
          e.stopPropagation();
          $("#baiduxiala").html("");
          var keystr=$(this).val();
          if(keystr.trim()=="") {   $("#tts").html("匹配到:0");return};
          keystr=keystr.trim();
          var  data ={
            "query": {
                "query_string":{
                "default_field": "id.keyword",
                "query": "*"+keystr+"*"
              }
            },
            "size": 150
          };
          $.ajax({ url: "http://172.30.1.85:9200/wd_runing/_search",
            type: 'POST',
            crossDomain: true,
            dataType: 'json',
            processData: false,
            data: JSON.stringify(data),
            success: function(data){
              $("#tts").html("匹配到:"+data.hits.total);
              $.each(data.hits.hits,function (i,obj) {
                  if(obj._id.trim()=="") return;
                $("#baiduxiala").append("<li style='float: left;width: 100%;'><a href='/allmb?wdid="+obj._id+"&model="+obj._type+"'>"+obj._id+"</a><span style='margin-left: 50px;background-color:lavender;padding: 5px;float: right'>"+eum[obj._type]+"</span></li><div style='clear: both'></div>");
              })
            }});
        })
      </script>
    </fieldset>
  </form>
</section>


